'\" t
.\"     Title: \fBmysqlbinlogmove\fR
.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\"      Date: 01/14/2017
.\"    Manual: MySQL Utilities
.\"    Source: MySQL 1.6.4
.\"  Language: English
.\"
.TH "\FBMYSQLBINLOGMOVE\F" "1" "01/14/2017" "MySQL 1\&.6\&.4" "MySQL Utilities"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
mysqlbinlogmove \- Binary log relocate utility
.SH "SYNOPSIS"
.HP \w'\fBmysqlbinlogmove\ [\fR\fB\fIoptions\fR\fR\fB]\ \fR\fB\fIdestination_directory>\fR\fR\ 'u
\fBmysqlbinlogmove [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdestination_directory>\fR\fR
.SH "DESCRIPTION"
.PP
This utility allows binary logs to be relocated to a different location in a simple and easy way\&. In particular, it moves existing binary logs to a specified location and updates the necessary server files (i\&.e\&., binary log index files) with the new location\&.
.PP
From a practical point of view, the use of this utility is recommended before you change the binary log base directory to move all binary log files to the target location, avoiding errors on the server when started with the new \-\-log\-bin location\&. It is also useful to archive older binary log files to a different location, in order to save disk space in the current partition\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
.PP
In order to relocate all binary log files, the MySQL server must be stopped\&. This requirement is not needed if binary log files that are not in use are moved\&.
.sp .5v
.RE
.PP
The user must provide the destination directory to move the binary log files as an argument and the server connection parameters with the
\fB\-\-server\fR
option or the source location of the binary log files using the option
\fB\-\-binlog\-dir\fR\&. When the
\fB\-\-server\fR
option is used, the utility determines the binary logs base filename and index file location from the server (depending on its version) and all binary log files are moved except the ones currently in use (with the higher sequence number)\&. In order to move all binary logs including those in use, the
\fB\-\-binlog\-dir\fR
option must be used, which requires the MySQL server to be stopped\&.
.PP
By default, the utility only moves binary log files\&. If the server is performing the role of a slave or if you want to move both binary and relay log files, you must use the
\fB\-\-log\-type\fR
option with the desired value\&.
.PP
When the server
\fB\-\-server\fR
is used, binary logs are flushed at the end of the move operation to refresh the cache\&. Users can skip this step using the
\fB\-\-skip\-flush\-binlogs\fR
option\&.
.PP
The utility always attempts to determine the necessary information (base filename, binary logs and index location) based on the available server\*(Aqs data or the default values\&. Nevertheless, custom values might be used and some variables might not be available for older server versions or simply the server connection might not provided\&. If custom filenames are used, the user can specify them using the options
\fB\-\-bin\-log\-index\fR,
\fB\-\-bin\-log\-basename\fR,
\fB\-\-relay\-log\-index\fR, and
\fB\-\-relay\-log\-basename\fR, respectively for binary log and relay log files\&.
.PP
By default, all of the binary log files found that are not in use are moved (except when the
\fB\-\-server\fR
option is used)\&. The
\fB\-\-sequence\fR
option can be used to restrict the files to move based on their sequence number\&. It is also possible to filter the files to move based on their modification date using the
\fB\-\-modified\-before\fR
option\&.
.PP
The utility displays the list of binary files that are moved\&. Users can also use the
\fB\-\-verbose\fR
option to see additional information when the utility executes (e\&.g\&., used values for server variables)\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
.PP
This utility was added in MySQL Utilities 1\&.6\&.0\&.
.sp .5v
.RE
OPTIONS.PP
\fBmysqlbinlogmove\fR
accepts the following command\-line options:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-binlog\-dir=\fIbinlog_dir\fR
.sp
Source directory (full path) for the binary log files to move\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-bin\-log\-basename=\fIbinlog_basename\fR
.sp
Basename for the binary log files\&. If not available, it is assumed to be any name ended with \*(Aq\-bin\*(Aq\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-bin\-log\-index=\fIbinlog_index\fR
.sp
Location (full path) of the binary log index file\&. If not specified, it is assumed to be located in the binary log directory\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-help
.sp
Display a help message and exit\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-license
.sp
Display license information and exit\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-log\-type=\fIlog_type\fR
.sp
Type of the binary log files to move, i\&.e\&. binary log or relay log files\&. Supported values: \*(Aqbin\*(Aq for binary log files, \*(Aqrelay\*(Aq for relay log files, \*(Aqall\*(Aq for both binary log and relay log files\&.
.sp
Default = bin\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-modified\-before=\fImodified_before\fR
.sp
Specify the datetime or number of days to move binary log files with a modified date prior to the specified value\&. Accepts a datetime in the format yyyy\-mm\-ddThh:mm:ss or yyyy\-mm\-dd, or an non\-negative integer indicating the number of elapsed days\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-relay\-log\-basename=\fIrelay_log_basename\fR
.sp
Basename for the relay log files\&. If not available, it is assumed to be any name ended with \*(Aq\-relay\-bin\*(Aq\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-relay\-log\-index=\fIrelay_log_index\fR
.sp
Location (full path) of the relay log index file\&. If not specified, it is assumed to be located in the binary log directory\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-sequence=\fIsequence_number_list\fR
.sp
Comma\-separated list of non\-negative sequence integers or intervals to move binary files with a matching sequence number\&. Specified sequence number intervals are closed (i\&.e\&., include both endpoints) and defined simply using a dash between its endpoints\&. For Example: 3,5\-12,16,21\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-server=\fIserver_connection\fR
.sp
Connection information for the server\&.
.sp
To connect to a server, it is necessary to specify connection parameters such as the user name, host name, password, and either a port or socket\&. MySQL Utilities provides a number of ways to supply this information\&. All of the methods require specifying your choice via a command\-line option such as \-\-server, \-\-master, \-\-slave, etc\&. The methods include the following in order of most secure to least secure\&.
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Use login\-paths from your
\&.mylogin\&.cnf
file (encrypted, not visible)\&. Example :
\fIlogin\-path\fR[:\fIport\fR][:\fIsocket\fR]
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Use a configuration file (unencrypted, not visible) Note: available in release\-1\&.5\&.0\&. Example :
\fIconfiguration\-file\-path\fR[:\fIsection\fR]
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Specify the data on the command\-line (unencrypted, visible)\&. Example :
\fIuser\fR[:\fIpasswd\fR]@\fIhost\fR[:\fIport\fR][:\fIsocket\fR]
.RE
.sp
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-skip\-flush\-binlogs
.sp
Skip the binary log flush operation to refresh server\*(Aqs internal information after moving the binary log files\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-ssl\-ca
.sp
The path to a file that contains a list of trusted SSL CAs\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-ssl\-cert
.sp
The name of the SSL certificate file to use for establishing a secure connection\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-ssl\-key
.sp
The name of the SSL key file to use for establishing a secure connection\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-ssl
.sp
Specifies if the server connection requires use of SSL\&. If an encrypted connection cannot be established, the connection attempt fails\&. Default setting is 0 (SSL not required)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-verbose, \-v
.sp
Specify how much information to display\&. Use this option multiple times to increase the amount of information\&. For example,
\fB\-v\fR
= verbose,
\fB\-vv\fR
= more verbose,
\fB\-vvv\fR
= debug\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\-\-version
.sp
Display version information and exit\&.
.RE
NOTES.PP
By default, binary logs are flushed after moving the files when the
\fB\-\-server\fR
option is used\&. In particular,
\fIFLUSH BINARY LOGS\fR
is executed after moving all binary log files and
\fIFLUSH RELAY LOGS\fR
after moving all relay log files\&. This flush operation is required to refresh the binary log data on the server, otherwise errors might occur or inconsistent information might be displayed regarding the moved files (without restarting the server)\&. For example, when executing the following statements:
\fISHOW BINLOG EVENTS\fR
and
\fISHOW BINARY LOGS\fR\&. Nevertheless, the flush operation also closes and reopens the binary log files\&. See
\m[blue]\fBFLUSH Syntax\fR\m[]\&\s-2\u[1]\d\s+2, for more information about the FLUSH statement\&. Recall that the
\fB\-\-skip\-flush\-binlogs\fR
option can be used to skip the flush operation\&.
.PP
The path to the MySQL client tools should be included in the PATH environment variable in order to use the authentication mechanism with login\-paths\&. This permits the utility to use the my_print_defaults tools, which is required to read the login\-path values from the login configuration file (\&.mylogin\&.cnf)\&.
LIMITATIONS.PP
This utility does not support remote access to binary log files and must be executed on the local server\&.
EXAMPLES.PP
Move available binary log files from a running server:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmysqlbinlogmove \-\-server=user:pass@localhost:3310 \e\fR
          \fB/archive/binlog_dir\fR
#
# Moving bin\-log files\&.\&.\&.
# \- server\-bin\&.000001
# \- server\-bin\&.000002
# \- server\-bin\&.000003
# \- server\-bin\&.000004
# \- server\-bin\&.000005
#
# Flushing binary logs\&.\&.\&.
#
#\&.\&.\&.done\&.
#
.fi
.if n \{\
.RE
.\}
.PP
Move all binary log files from a stopped server specifying the source binary log directory:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmysqlbinlogmove \-\-binlog\-dir=/server/data \e\fR
          \fB/new/binlog_dir\fR
#
# Moving bin\-log files\&.\&.\&.
# \- server\-bin\&.000001
# \- server\-bin\&.000002
# \- server\-bin\&.000003
# \- server\-bin\&.000004
# \- server\-bin\&.000005
# \- server\-bin\&.000006
#
#\&.\&.\&.done\&.
#
.fi
.if n \{\
.RE
.\}
.PP
Move available relay log files from a running slave:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmysqlbinlogmove \-\-server=user:pass@localhost:3311 \e\fR
          \fB\-\-log\-type=relay /archive/slave/binlog_dir\fR
#
# Moving relay\-log files\&.\&.\&.
# \- slave\-relay\-bin\&.000001
# \- slave\-relay\-bin\&.000002
# \- slave\-relay\-bin\&.000003
# \- slave\-relay\-bin\&.000004
# \- slave\-relay\-bin\&.000005
# \- slave\-relay\-bin\&.000006
# \- slave\-relay\-bin\&.000007
# \- slave\-relay\-bin\&.000008
# \- slave\-relay\-bin\&.000009
# \- slave\-relay\-bin\&.000010
# \- slave\-relay\-bin\&.000011
# \- slave\-relay\-bin\&.000012
# \- slave\-relay\-bin\&.000013
# \- slave\-relay\-bin\&.000014
# \- slave\-relay\-bin\&.000015
# \- slave\-relay\-bin\&.000016
#
# Flushing relay logs\&.\&.\&.
#
#\&.\&.\&.done\&.
#
.fi
.if n \{\
.RE
.\}
.PP
Move available binary log and relay log files from a running slave skipping the flush step:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmysqlbinlogmove \-\-server=user:pass@localhost:3311 \e\fR
          \fB\-\-log\-type=all \-\-skip\-flush\-binlogs \e\fR
          \fB/archive/slave/binlog_dir\fR
#
# Moving bin\-log files\&.\&.\&.
# \- slave\-bin\&.000001
# \- slave\-bin\&.000002
# \- slave\-bin\&.000003
# \- slave\-bin\&.000004
# \- slave\-bin\&.000005
#
#
# Moving relay\-log files\&.\&.\&.
# \- slave\-relay\-bin\&.000001
# \- slave\-relay\-bin\&.000002
# \- slave\-relay\-bin\&.000003
# \- slave\-relay\-bin\&.000004
# \- slave\-relay\-bin\&.000005
# \- slave\-relay\-bin\&.000006
# \- slave\-relay\-bin\&.000007
# \- slave\-relay\-bin\&.000008
# \- slave\-relay\-bin\&.000009
# \- slave\-relay\-bin\&.000010
# \- slave\-relay\-bin\&.000011
# \- slave\-relay\-bin\&.000012
# \- slave\-relay\-bin\&.000013
# \- slave\-relay\-bin\&.000014
# \- slave\-relay\-bin\&.000015
# \- slave\-relay\-bin\&.000016
#
#\&.\&.\&.done\&.
#
.fi
.if n \{\
.RE
.\}
.PP
Move available binary log files from a running slave matching the specified sequence numbers:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmysqlbinlogmove \-\-server=user:pass@localhost:3311 \e\fR
          \fB\-\-log\-type=all \-\-sequence=2,4\-7,11,13 \e\fR
          \fB/archive/slave/binlog_dir\fR
#
# Applying sequence filter to bin\-log files\&.\&.\&.
#
# Moving bin\-log files\&.\&.\&.
# \- slave\-bin\&.000002
# \- slave\-bin\&.000004
# \- slave\-bin\&.000005
# \- slave\-bin\&.000006
#
# Flushing binary logs\&.\&.\&.
#
#
# Applying sequence filter to relay\-log files\&.\&.\&.
#
# Moving relay\-log files\&.\&.\&.
# \- slave\-relay\-bin\&.000002
# \- slave\-relay\-bin\&.000004
# \- slave\-relay\-bin\&.000005
# \- slave\-relay\-bin\&.000006
# \- slave\-relay\-bin\&.000007
# \- slave\-relay\-bin\&.000011
# \- slave\-relay\-bin\&.000013
#
# Flushing relay logs\&.\&.\&.
#
#\&.\&.\&.done\&.
#
.fi
.if n \{\
.RE
.\}
.PP
Move available binary log files modified two days ago from a running slave:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmysqlbinlogmove \-\-server=user:pass@localhost:3311 \e\fR
          \fB\-\-log\-type=all \-\-modified\-before=2 \e\fR
          \fB/archive/slave/binlog_dir\fR
#
# Applying modified date filter to bin\-log files\&.\&.\&.
#
# Moving bin\-log files\&.\&.\&.
# \- slave\-bin\&.000001
# \- slave\-bin\&.000002
# \- slave\-bin\&.000003
#
# Flushing binary logs\&.\&.\&.
#
#
# Applying modified date filter to relay\-log files\&.\&.\&.
#
# Moving relay\-log files\&.\&.\&.
# \- slave\-relay\-bin\&.000001
# \- slave\-relay\-bin\&.000002
# \- slave\-relay\-bin\&.000003
# \- slave\-relay\-bin\&.000004
# \- slave\-relay\-bin\&.000005
# \- slave\-relay\-bin\&.000006
# \- slave\-relay\-bin\&.000007
# \- slave\-relay\-bin\&.000008
# \- slave\-relay\-bin\&.000009
# \- slave\-relay\-bin\&.000010
#
# Flushing relay logs\&.\&.\&.
#
#\&.\&.\&.done\&.
.fi
.if n \{\
.RE
.\}
.PP
Move available binary log files modified prior to the specified date from a running slave:
.sp
.if n \{\
.RS 4
.\}
.nf
shell> \fBmysqlbinlogmove \-\-server=user:pass@localhost:3311 \e\fR
          \fB\-\-log\-type=all \-\-modified\-before=2014\-08\-31 \e\fR
          \fB/archive/slave/binlog_dir\fR
#
# Applying modified date filter to bin\-log files\&.\&.\&.
#
# Moving bin\-log files\&.\&.\&.
# \- slave\-bin\&.000001
# \- slave\-bin\&.000002
# \- slave\-bin\&.000003
#
# Flushing binary logs\&.\&.\&.
#
#
# Applying modified date filter to relay\-log files\&.\&.\&.
#
# Moving relay\-log files\&.\&.\&.
# \- slave\-relay\-bin\&.000001
# \- slave\-relay\-bin\&.000002
# \- slave\-relay\-bin\&.000003
# \- slave\-relay\-bin\&.000004
# \- slave\-relay\-bin\&.000005
# \- slave\-relay\-bin\&.000006
# \- slave\-relay\-bin\&.000007
# \- slave\-relay\-bin\&.000008
# \- slave\-relay\-bin\&.000009
# \- slave\-relay\-bin\&.000010
#
# Flushing relay logs\&.\&.\&.
#
#\&.\&.\&.done\&.
.fi
.if n \{\
.RE
.\}
.sp
PERMISSIONS REQUIRED.PP
By default, the user account used to connect to the server must have permissions to flush the binary logs, more precisely the RELOAD privilege is required, except if the flush step is skipped\&.
.PP
Additionally, the user account used to execute the utility must have read and write access to the location of the binary log and index files as well as the destination directory to move the files\&.
.SH "COPYRIGHT"
.br
.PP
Copyright \(co 2006, 2017, Oracle and/or its affiliates. All rights reserved.
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
.PP
You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/.
.sp
.SH "NOTES"
.IP " 1." 4
FLUSH Syntax
.RS 4
\%http://dev.mysql.com/doc/refman/5.7/en/flush.html
.RE
.SH "SEE ALSO"
For more information, please refer to the MySQL Utilities and Fabric
documentation, which is available online at
http://dev.mysql.com/doc/index-utils-fabric.html
.SH AUTHOR
Oracle Corporation (http://dev.mysql.com/).
